package action;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

import basic.PageInfo;
import basic.QuerySet;
import basic.ResultSet;
import basic.SortInfo;
import common.BaseAction;
import entities.TCurrency;
import interfaces.ICurrencyService;
import util.ParameterUtil;
import utils.StringUtil;

public class CurrencyAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7507534255609348887L;

	private ICurrencyService currencyService;

	private TCurrency currencyBean;
	private List<TCurrency> currencyList;

	private String curNo;
	private String curNos;
	private String curName;
	private Double curRate;
	private String curState;
	private Date curDate;
	private Date curDateTop;
	private Date curDateEnd;
	private String curRemark;

	public String list() throws Exception {
		QuerySet<Object> querySet = new QuerySet<Object>();

		HashMap<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("curNo", StringUtil.split(curNo));
		paramMap.put("curDate", ParameterUtil.dateCombin(curDateTop, curDateEnd));

		SortInfo sortInfo = new SortInfo();
		sortInfo.setSortField((StringUtil.isEmpty(sortField)) ? "curNo" : sortField);
		sortInfo.setSortOrder(new Boolean(true));

		querySet.setPageInfo(new PageInfo(1, Integer.MAX_VALUE));
		querySet.setSortInfo(sortInfo);
		querySet.setParamMap(paramMap);

		ResultSet<TCurrency> resultSet = currencyService.search(querySet);
		currencyList = resultSet.getResultList();
		pageInfo = resultSet.getPageInfo();
		return SUCCESS;
	}


	////////////////////// ---------------------------//////////////////////////////////////////////////////////////////////////////////////////////////////////////
	////////////////////// ---------------------------//////////////////////////////////////////////////////////////////////////////////////////////////////////////
	////////////////////// ---------------------------//////////////////////////////////////////////////////////////////////////////////////////////////////////////

	public ICurrencyService getCurrencyService() {
		return currencyService;
	}

	public void setCurrencyService(ICurrencyService currencyService) {
		this.currencyService = currencyService;
	}

	public TCurrency getCurrencyBean() {
		return currencyBean;
	}

	public void setCurrencyBean(TCurrency currencyBean) {
		this.currencyBean = currencyBean;
	}

	public List<TCurrency> getCurrencyList() {
		return currencyList;
	}

	public void setCurrencyList(List<TCurrency> currencyList) {
		this.currencyList = currencyList;
	}

	public String getCurNo() {
		return curNo;
	}

	public void setCurNo(String curNo) {
		this.curNo = curNo;
	}

	public String getCurNos() {
		return curNos;
	}

	public void setCurNos(String curNos) {
		this.curNos = curNos;
	}

	public String getCurName() {
		return curName;
	}

	public void setCurName(String curName) {
		this.curName = curName;
	}

	public Double getCurRate() {
		return curRate;
	}

	public void setCurRate(Double curRate) {
		this.curRate = curRate;
	}

	public String getCurState() {
		return curState;
	}

	public void setCurState(String curState) {
		this.curState = curState;
	}

	public Date getCurDate() {
		return curDate;
	}

	public void setCurDate(Date curDate) {
		this.curDate = curDate;
	}

	public Date getCurDateTop() {
		return curDateTop;
	}

	public void setCurDateTop(Date curDateTop) {
		this.curDateTop = curDateTop;
	}

	public Date getCurDateEnd() {
		return curDateEnd;
	}

	public void setCurDateEnd(Date curDateEnd) {
		this.curDateEnd = curDateEnd;
	}

	public String getCurRemark() {
		return curRemark;
	}

	public void setCurRemark(String curRemark) {
		this.curRemark = curRemark;
	}

}
